home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
gnu
/
gas
/
gassrc04.zoo
/
sparc.up
< prev
next >
Wrap
Text File
|
1991-09-13
|
38KB
|
844 lines
Newsgroups: gnu.utils.bug
From: gordoni@chook.cs.adelaide.edu.au (Gordon Irlam)
Subject: GAS 1.38 (sparc) patches
Organization: GNUs Not Usenet
Distribution: gnu
Date: Sat, 7 Sep 1991 02:26:04 GMT
The following patches fix a few small problems with the SPARC version
of gas 1.38.
1) A .empty directive has been added. This is for compatibility with
SunOS. It is needed sometimes for code fed to the SunOS assembler
to prevent the Sun assembler adding illegal nops to perfectly good
code. Adding it to the sparc version of gas allows gas to assemble
the same file.
2) In gas 1.38 the code for handling the RELOC_32 type was commented out
and the result set to zero. I can't see any reason why this was done.
The resulting code is wrong. The following small program illustrates
this: start will have the value 0 instead of 4.
.text
start: .word finish - start
finish:
3) Copy the version of sparc-opcode.h from gdb-4.0. The version of
sparc-opcode.h in gas 1.38 does not include the dec, deccc, or
cb01 instructions.
Gordon Irlam
(gordoni@cs.adelaide.edu.au)
diff -c old/sparc.c new/sparc.c
*** old/sparc.c Tue Oct 23 03:34:04 1990
--- new/sparc.c Fri Sep 6 16:10:08 1991
***************
*** 55,66 ****
/* handle of the OPCODE hash table */
static struct hash_control *op_hash = NULL;
! static void s_seg(), s_proc(), s_data1(), s_reserve(), s_common();
extern void s_globl(), s_long(), s_short(), s_space(), cons();
const pseudo_typeS
md_pseudo_table[] = {
{ "common", s_common, 0 },
{ "global", s_globl, 0 },
{ "half", cons, 2 },
{ "proc", s_proc, 0 },
--- 55,67 ----
/* handle of the OPCODE hash table */
static struct hash_control *op_hash = NULL;
! static void s_seg(), s_proc(), s_data1(), s_reserve(), s_common(), s_empty();
extern void s_globl(), s_long(), s_short(), s_space(), cons();
const pseudo_typeS
md_pseudo_table[] = {
{ "common", s_common, 0 },
+ { "empty", s_empty, 0 }, /* GI: For SunOS compatability */
{ "global", s_globl, 0 },
{ "half", cons, 2 },
{ "proc", s_proc, 0 },
***************
*** 106,116 ****
#define isoctal(c) octal[c]
static unsigned char toHex[256];
- /*
- * anull bit - causes the branch delay slot instructions to not be executed
- */
- #define ANNUL (1 << 29)
-
struct sparc_it {
char *error;
unsigned long opcode;
--- 107,112 ----
***************
*** 251,257 ****
--- 247,267 ----
return;
}
+ /*
+ * GI: This is needed for compatability with Sun's assembler - which
+ * otherwise generates a warning when certain "suspect" instructions
+ * appear in the delay slot of a branch. And more seriously without
+ * this directive in certain cases Sun's assembler will rearrange
+ * code thinking it knows how to alter things when it doesn't.
+ */
static void
+ s_empty()
+ {
+ demand_empty_rest_of_line();
+ return;
+ }
+
+ static void
s_seg()
{
***************
*** 999,1008 ****
switch (fixP->fx_r_type) {
case RELOC_32:
! buf[0] = 0; /* val >> 24; */
! buf[1] = 0; /* val >> 16; */
! buf[2] = 0; /* val >> 8; */
! buf[3] = 0; /* val; */
break;
#if 0
--- 1009,1021 ----
switch (fixP->fx_r_type) {
case RELOC_32:
! /*
! * GI: This was commented out. Why? It is needed.
! */
! buf[0] = val >> 24;
! buf[1] = val >> 16;
! buf[2] = val >> 8;
! buf[3] = val;
break;
#if 0
diff -c old/sparc-opcode.h new/sparc-opcode.h
*** old/sparc-opcode.h Fri Jun 8 05:52:10 1990
--- new/sparc-opcode.h Fri Sep 6 16:10:08 1991
***************
*** 3,21 ****
This file is part of GAS, the GNU Assembler, and GDB, the GNU disassembler.
! GAS/GDB is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
! the Free Software Foundation; either version 1, or (at your option)
! any later version.
! GAS/GDB is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
! along with GAS or GDB; see the file COPYING. If not, write to
! the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#if !defined(__STDC__) && !defined(const)
#define const
--- 3,21 ----
This file is part of GAS, the GNU Assembler, and GDB, the GNU disassembler.
! This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
! the Free Software Foundation; either version 2 of the License, or
! (at your option) any later version.
! This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
! along with this program; if not, write to the Free Software
! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#if !defined(__STDC__) && !defined(const)
#define const
***************
*** 30,39 ****
unsigned long int match; /* Bits that must be set. */
unsigned long int lose; /* Bits that must not be set. */
const char *args;
! /* Nonzero if this is a delayed branch instruction. */
! char delayed;
};
/*
All sparc opcodes are 32 bits, except for the `set' instruction (really
a macro), which is 64 bits. It is handled as a special case.
--- 30,41 ----
unsigned long int match; /* Bits that must be set. */
unsigned long int lose; /* Bits that must not be set. */
const char *args;
! char flags;
};
+ #define F_DELAYED 1 /* Delayed branch */
+ #define F_ALIAS 2 /* Alias for a "real" instruction */
+
/*
All sparc opcodes are 32 bits, except for the `set' instruction (really
a macro), which is 64 bits. It is handled as a special case.
***************
*** 174,184 ****
{ "st", 0xc1202000, 0x00d80000, "g,[1+i]", 0 },
{ "st", 0xc1202000, 0x00d80000, "g,[i+1]", 0 },
{ "st", 0xc1200000, 0x00d82000, "g,[1+2]", 0 },
! { "st", 0xc1280000, 0x00c0d01f, "F,[1]", 0 }, /* st d,[rs1+%g0] */
! { "st", 0xc1282000, 0x00c0dfff, "F,[1]", 0 }, /* st d,[rs1+0] */
! { "st", 0xc1282000, 0x00c0d000, "F,[1+i]", 0 },
! { "st", 0xc1282000, 0x00c0d000, "F,[i+1]", 0 },
! { "st", 0xc1280000, 0x00c0d000, "F,[1+2]", 0 },
{ "st", 0xc1a00000, 0x0058201f, "D,[1]", 0 }, /* st d,[rs1+%g0] */
{ "st", 0xc1a02000, 0x00581fff, "D,[1]", 0 }, /* st d,[rs1+0] */
{ "st", 0xc1a02000, 0x00580000, "D,[1+i]", 0 },
--- 176,186 ----
{ "st", 0xc1202000, 0x00d80000, "g,[1+i]", 0 },
{ "st", 0xc1202000, 0x00d80000, "g,[i+1]", 0 },
{ "st", 0xc1200000, 0x00d82000, "g,[1+2]", 0 },
! { "st", 0xc1280000, 0x00d0201f, "F,[1]", 0 }, /* st %fsr,[rs1+%g0] */
! { "st", 0xc1282000, 0x00d01fff, "F,[1]", 0 }, /* st %fsr,[rs1+0] */
! { "st", 0xc1282000, 0x00d00000, "F,[1+i]", 0 },
! { "st", 0xc1282000, 0x00d00000, "F,[i+1]", 0 },
! { "st", 0xc1280000, 0x00d02000, "F,[1+2]", 0 },
{ "st", 0xc1a00000, 0x0058201f, "D,[1]", 0 }, /* st d,[rs1+%g0] */
{ "st", 0xc1a02000, 0x00581fff, "D,[1]", 0 }, /* st d,[rs1+0] */
{ "st", 0xc1a02000, 0x00580000, "D,[1+i]", 0 },
***************
*** 248,268 ****
{ "restore", 0x81e82000, 0x7e14dfff, "", 0 }, /* restore %g0,0,%g0 */
{ "restore", 0x81e82000, 0x00000000, "1,i,d", 0 },
{ "restore", 0x81e80000, 0x00000000, "1,2,d", 0 },
! { "rett", 0x81c82000, 0x40300000, "1+i", 1 },
! { "rett", 0x81c82000, 0x40300000, "i+1", 1 },
! { "rett", 0x81c80000, 0x40302000, "1+2", 1 },
! { "rett", 0x81c82000, 0x40300000, "1", 1},
{ "save", 0x81e02000, 0x40180000, "1,i,d", 0 },
{ "save", 0x81e00000, 0x401800